use "C:\Documents and Settings\axz051000\My Documents\guale2009\stan\cps\restatonline\incomepercapitaresubmit1995.dta" 

append using incomepercapitaresubmit1997.dta
append using incomepercapitaresubmit1998.dta
append using incomepercapitaresubmit2000.dta
append using incomepercapitaresubmit2001.dta
append using incomepercapitaresubmit2003.dta


joinby gtmsa using dmamsasep2008.dta, unmatched(both)
tab _merge

egen medianincomepercapita1995=median(incomedolarspercap1995), by(dmacode)
egen medianincomepercapita1997=median(incomedolarspercap1997), by(dmacode)
egen medianincomepercapita1998=median(incomedolarspercap1998), by(dmacode)
egen medianincomepercapita2000=median(incomedolarspercap2000), by(dmacode)
egen medianincomepercapita2001=median(incomedolarspercap2001), by(dmacode)
egen medianincomepercapita2003=median(incomedolarspercap2003), by(dmacode)

egen medianincomepercapita634_1995=median(incomedolarspercap634_1995), by(dmacode)
egen medianincomepercapita634_1997=median(incomedolarspercap634_1997), by(dmacode)
egen medianincomepercapita634_1998=median(incomedolarspercap634_1998), by(dmacode)
egen medianincomepercapita634_2000=median(incomedolarspercap634_2000), by(dmacode)
egen medianincomepercapita634_2001=median(incomedolarspercap634_2001), by(dmacode)
egen medianincomepercapita634_2003=median(incomedolarspercap634_2003), by(dmacode)

egen medianincomepercapita3554_1995=median(incomedolarspercap3554_1995), by(dmacode)
egen medianincomepercapita3554_1997=median(incomedolarspercap3554_1997), by(dmacode)
egen medianincomepercapita3554_1998=median(incomedolarspercap3554_1998), by(dmacode)
egen medianincomepercapita3554_2000=median(incomedolarspercap3554_2000), by(dmacode)
egen medianincomepercapita3554_2001=median(incomedolarspercap3554_2001), by(dmacode)
egen medianincomepercapita3554_2003=median(incomedolarspercap3554_2003), by(dmacode)


egen medianincomepercapita55plus_1995=median(incomedolarspercap55plus_1995), by(dmacode)
egen medianincomepercapita55plus_1997=median(incomedolarspercap55plus_1997), by(dmacode)
egen medianincomepercapita55plus_1998=median(incomedolarspercap55plus_1998), by(dmacode)
egen medianincomepercapita55plus_2000=median(incomedolarspercap55plus_2000), by(dmacode)
egen medianincomepercapita55plus_2001=median(incomedolarspercap55plus_2001), by(dmacode)
egen medianincomepercapita55plus_2003=median(incomedolarspercap55plus_2003), by(dmacode)

collapse medianincomepercapita634_1995 medianincomepercapita634_1997 medianincomepercapita634_1998 medianincomepercapita634_2000 medianincomepercapita634_2001 medianincomepercapita634_2003 medianincomepercapita3554_1995 medianincomepercapita3554_1997 medianincomepercapita3554_1998 medianincomepercapita3554_2000 medianincomepercapita3554_2001 medianincomepercapita3554_2003 medianincomepercapita55plus_1995 medianincomepercapita55plus_1997 medianincomepercapita55plus_1998 medianincomepercapita55plus_2000 medianincomepercapita55plus_2001 medianincomepercapita55plus_2003 medianincomepercapita1995 medianincomepercapita1997 medianincomepercapita1998 medianincomepercapita2000 medianincomepercapita2001 medianincomepercapita2003, by(dmacode)

save "C:\Documents and Settings\axz051000\My Documents\guale2009\stan\cps\restatonline\medianincomepercapita.dta", replace
